
#ifndef __WEBNET_H__
#define __WEBNET_H__

#ifdef __cplusplus
extern "C" {
#endif

#define  WEBNET_USING_CGI              1
#define  WEBNET_USING_ASP              0
#define  WEBNET_USING_ALIAS            0
#define  WEBNET_USING_AUTH             0
#define  WEBNET_USING_UPLOAD           0
#define  WEBNET_USING_INDEX            0
#define  WEBNET_USING_SSI              0


//#ifndef WEBNET_USING_RANGE
//#define WEBNET_USING_RANGE
//#endif
//    
//#ifndef WEBNET_USING_KEEPALIVE
//#define WEBNET_USING_KEEPALIVE
//#endif

//#ifndef WEBNET_USING_COOKIE
//#define WEBNET_USING_COOKIE
//#endif

#define TRUE                            (1)
#define FALSE                           (0)

#define WEBNET_PATH_MAX                 (32)
#define POST_BUFSZ_MAX                  (256)
#define WEBNET_VERSION                  "1.0.0"
#define WEBNET_SERVER                   "Server: CET_Server "WEBNET_VERSION"\r\n"
#define ALIGN_DOWN(size, align)         ((size) & ~((align) - 1))


struct webnet_session;
struct webnet_query_item
{
    char* name;
    char* value;
};

void webnet_init(void);
void webnet_set_root(const char* webroot_path);
const char* webnet_get_root(void);
void webnet_handle(unsigned int s_Client,char *cliIp);

#include <stdarg.h>
#include <stdint.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <wn_timer.h>
#include <wn_session.h>
#include <wn_module.h>
#include <wn_utils.h>
#include <wn_request.h>
#include <heap.h>

extern Heap_t hd;
#define   wn_strdup(s)             pvPortStrdup(&hd,s)
#define   wn_memdup(s,size)        pvPortMemdup(&hd,s,size)  
#define   wn_realloc(mp,newsize)   vPortRealloc(&hd,mp,newsize)        
#define   wn_free(mp)              vPortFree(&hd,mp)
#define   wn_malloc(size)          pvPortMalloc(&hd,size)

#ifndef ASSERT
#define ASSERT(EX)          if (!(EX)){printf("File:\\ %s Line: %d: \r\n",__FILE__, __LINE__);}
#endif

#ifdef  __cplusplus
}
#endif

#endif /* __WEBNET_H__ */
